class Header extends HTMLElement {
    constructor() {
        super();
    }

    connectedCallback() {
        const currentPath = window.location.pathname;
        this.innerHTML = `
            <header class="header">
                <a href="/order/views/main/index.html" class="logo">订单管理系统</a>
                <nav class="nav">
                    <a href="/" class="nav-item ${currentPath === '/' ? 'active' : ''}">首页</a>
                    <a href="/order/views/sale/index.html" class="nav-item ${currentPath.includes('/sale') ? 'active' : ''}">销售订单</a>
                    <a href="/order/views/after_sale/index.html" class="nav-item ${currentPath.includes('/after_sale') ? 'active' : ''}">售后订单</a>
                </nav>
            </header>
        `;
    }
}

customElements.define('lap-order-header', Header);